var express=require('express');
var router=new express.Router();

var users=[
  {
    username:'admin',
    password:'123456'
  },
  {
    username:'text',
    password:'text'
  }
]

router.get('/login',function (req,res){
   var loginUser={
     username:req.query.username,
     password:req.query.password,
   }
   var foundUser=users.find(function (user) {
     return user.username==loginUser.username&&user.password==loginUser.password;
   })
  if (foundUser) {
    res.send({
      flag: true
    })
  }
  else
    {
      res.send({
        flag: false
      })
    }

})

module.exports = router;
